package com.distribution.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.distribution.system.domain.bo.RefreshOrderBO;
import com.distribution.system.domain.entity.CmccDaOrder;
import com.distribution.system.domain.entity.CmccDaOrder;
import com.distribution.system.domain.req.CmccDaOrderListReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author Liping Huo
 * @date 2023/5/22 21:52
 */
@Mapper
public interface CmccDaOrderMapper extends BaseMapper<CmccDaOrder> {

    /**
     * 根据订单ID 获取 完成条件id
     *
     * @param orderNo 订单编号
     * @return 完成条件id
     */
    Integer getProfitConditionIdByOrderNo(String orderNo);

    /**
     * 根据 三方刷新返回值 更新数据库Order对象
     *
     * @param refreshOrderBo 三方返回值
     */

    void updateOrderByRefreshOrderBO(@Param("refreshOrderBo") RefreshOrderBO refreshOrderBo, @Param("orderStatus") String orderStatus,
                                     @Param("orderStatusDesc") String orderStatusDesc, @Param("profitConditionStatusCode") int profitConditionStatusCode);

    void updateOrderisWriteOff(@Param("CmccDaOrder")CmccDaOrder CmccDaOrder);

    /**
     * 获取未完成订单编号
     *
     * @return
     */
    List<String> getMateUnfinishedOrder();

    /**
     * 获取用户订单信息 包含所有下级的订单信息
     *
     * @param cmccDaOrderListReq
     * @param userIds
     * @return
     */

    List<CmccDaOrder> selectOrderList(@Param("cmccDaOrderListReq") CmccDaOrderListReq cmccDaOrderListReq, @Param("userIds") List<Long> userIds);

    List<CmccDaOrder> selectOrderByaddressStreet(@Param("CmccDaOrder")CmccDaOrder CmccDaOrder);
}
